﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace XMLConstructor
{
    public partial class Form_XMLNextStep : Form
    {
        public Form_XMLNextStep()
        {
            InitializeComponent();
        }
        public Form_XMLEditor form;
        public XmlDialogState state;

        public Form_XMLNextStep(Form_XMLEditor form, XmlDialogState state) : this()
        {
            this.form = form;
            this.state = state;
            switch (state)
            {
                //case OpenNewUninstall.Open:break;
                case XmlDialogState.New: button_Direct.Text = "直接新建"; break;
                case XmlDialogState.Uninstall: button_Direct.Text = "直接卸载"; break;
                case XmlDialogState.Exit: button_Direct.Text = "直接退出"; break;
            }
        }

        private void button_Open_Click(object sender, EventArgs e)
        {
            switch (state)
            {
                case XmlDialogState.Open: form.xmlDialogResult = XmlDialogState.Open; break;
                case XmlDialogState.New: form.xmlDialogResult = XmlDialogState.New; break;
                case XmlDialogState.Uninstall: form.xmlDialogResult = XmlDialogState.Uninstall; break;
                case XmlDialogState.Exit: form.xmlDialogResult = XmlDialogState.Exit; break;
            }
            this.Close();
        }

        private void button_Cancel_Click(object sender, EventArgs e)
        {
            form.xmlDialogResult = XmlDialogState.Cancel;
            this.Close();
        }

        private void button_SaveAs_Click(object sender, EventArgs e)
        {
            form.xmlDialogResult = XmlDialogState.SaveAs;
            this.Close();
        }

        private void button_Save_Click(object sender, EventArgs e)
        {
            form.xmlDialogResult = XmlDialogState.Save;
            this.Close();
        }

    }
    public enum XmlDialogState
    {
        Open, Save, SaveAs, Cancel, New, Uninstall, Exit,None
    }


}
